﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Hang.Blog.Helper {
    public static class SttreamHelper {
        public static MemoryStream StreamToMemoryStream(Stream instream) {
            MemoryStream outstream = new MemoryStream();
            const int bufferLen = 4096;
            byte[] buffer = new byte[bufferLen];
            int count = 0;
            while ((count = instream.Read(buffer, 0, bufferLen)) > 0) {
                outstream.Write(buffer, 0, count);
            }
            return outstream;
        }
    }
}
